Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

99
Visualizações
How can I get a result from the function $(window).on("message")?

I want to get "msg.sheet" and "msg.instance_url" out of the following code:

function checkT() {
    $(window).on("message", async function (event) {
        let origin = event.origin || event.originalEvent.origin;
        if (origin !== "https://***.***.com") return;
        let msg = event.data || event.originalEvent.data;
        if (msg.sheet == 'undefined') {
            client.invoke('notify', 'You must login in.');
        } else {
            return {
            sheet: msg.sheet,
            instance_url: msg.instance_url
        }
        }
    })
}

let data = checkT()
console.log(data) // {sheet: msg.sheet, instance_url: msg.instance_url}

can it be solved with promises?

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda